<?php

namespace App\Http\Resources\Agent;

use Illuminate\Http\Resources\Json\ResourceCollection;

class CityCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
          'code'=>0,
          'data'=>$this->collection->map(function($item){
              return $item->children->title;
          })
        ];
    }
}
